package games.platformer.behaviors;

import games.platformer.Level;
import vooga.core.Sound;

/**
 * When the PlayerCharacter runs into an enemy, they die
 * 
 * @author Jonathan Odom
 * @author bshelton
 */
public class IntersectAndDie extends Intersect
{
	private Level myLevel;
	private Sound mySound;
	
    public IntersectAndDie (vooga.geom.Vector velocity,
    		vooga.entities.Entity obstacle, Level level, String sound)
    {
        super(velocity, obstacle);
        myLevel = level;
        mySound = new Sound(sound);
    }

    public IntersectAndDie (vooga.geom.Vector velocity,
                               java.util.List<vooga.entities.Entity> obstacles, Level level, String sound)
    {
        super(velocity, obstacles);
        myLevel = level;
        mySound = new Sound(sound);
    }
    
    public IntersectAndDie (vooga.geom.Vector velocity,
            java.util.Collection<vooga.entities.Entity> obstacles, Level level, String sound)
    {
    	super(velocity, obstacles);
    	myLevel = level;
    	mySound = new Sound(sound);
	}


    protected void onCollide (vooga.entities.Entity lhs, vooga.entities.Entity rhs)
    {
    	mySound.play();
    	myLevel.loseLife();
    }
}
